package com.cci.kangdao.controller;

import com.cci.kangdao.service.CommonNotifyRecordService;
import com.cci.kangdao.utilTool.ParameterTool;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;

/**
 * @author William Du
 * @date 2020/8/3
 */
@Controller
public class CommonNotifyRecordController {

    private Logger log = Logger.getLogger(this.getClass().getName());

    @Resource
    private CommonNotifyRecordService commonNotifyRecordService;

    @RequestMapping("/getPagedOrderListByNotifyCategory.aspx")
    public ModelAndView getPagedOrderListByNotifyCategory(HttpServletRequest request, HttpServletResponse response) {
        try{
            Map<String, Object> map = ParameterTool.getParameterRequest(request, true);
            map.put("response", response);
            map.put("request", request);
            commonNotifyRecordService.getPagedOrderListByNotifyCategory(map);
        }catch(Exception ex){
            log.error(ex.getMessage(),ex);
            String msg = "{\"status\": -99,\"msg\": \"未知错误\"}";
            ParameterTool.writeResponse(response, msg);
        }
        return null;
    }

    @RequestMapping("/getNotifyList.aspx")
    public ModelAndView syncOrderInfo(HttpServletRequest request, HttpServletResponse response) {
        try{
            Map<String, Object> map = ParameterTool.getParameterRequest(request, true);
            map.put("response", response);
            map.put("request", request);
            commonNotifyRecordService.getNotifyList(map);
        }catch(Exception ex){
            log.error(ex.getMessage(),ex);
            String msg = "{\"status\": -99,\"msg\": \"未知错误\"}";
            ParameterTool.writeResponse(response, msg);
        }
        return null;
    }

}
